﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using Nofs.Net.AnnotationDriver;
using NUnit.Core;
using NUnit.Framework;

namespace nofs.fuse.test
{
    /// <summary>
    /// NoFSClassLoaderTest
    /// </summary>
    [TestFixture]
    [Category("NoFSClassLoader")]
    class NoFSClassLoaderTest : BaseTest
    {
        private NoFSClassLoader loader;

        public NoFSClassLoaderTest()
        {
            string folder = Path.GetDirectoryName(Path.GetFullPath(Process.GetCurrentProcess().MainModule.ModuleName));
            string fileName = folder + @"\..\..\..\..\nofs-addressbook\bin\Debug\nofs-addressbook.dll";
            if (File.Exists(fileName))
            {
                loader = new NoFSClassLoader(fileName);

                foreach(KeyValuePair<string, List<string>> pair in new ClassLoaderTest(fileName).LoadAllClass())
                {
                    Console.WriteLine(pair.Key);
                    Console.WriteLine("----------------------");
                    foreach (string t in pair.Value)
                    {
                        Console.Write("\t");
                        Console.Write(t);
                    }
                    Console.Write("\r\n");
                    Console.WriteLine("----------------------");
                }
            }
        }

        internal NoFSClassLoader TestInstance
        {
            get
            {
                return loader;
            }
        }

        [Test]
        public void TestLoadClass()
        {
            Assert.IsNotNull(loader);
        }
    }
}
